<template>
	<view>
		<zy-search :is-focus="false" :theme="themeClass" :show-want="showWant" :keyWord="searchText" :show-his="showWant" :speechEngine="speechEngine"
		:hot-list="hotList" @getSearchText="getSearchText" @showWantRecord="showWantRecord"></zy-search>
	
	
		<view v-if="!showWant" style="padding-left: 30rpx;padding-right: 30rpx;">
			<contextSearch :searchText="searchText" ref="contextSearchRef"></contextSearch>
		</view>
	</view>
	
	
	
</template>

<script>
	import zySearch from '../../components/zy-search.vue'
	import contextSearch from '../../components/context-search.vue'
	export default {
		components: {
			zySearch,
			contextSearch
		},
		
		onLoad(options) {
			
			if(options.context!=undefined&&options.context!=''){
				// this.searchText = options.context;
				// this.getSearchText(options.context);
				
			}
		},
		data() {
			return {
				searchText:'',
				showWant:true,
				themeClass: 'block',
				speechEngine: 'baidu', //语音识别引擎
				hotList: []	//初始化推荐列表
			}
		},
		methods: {
			showWantRecord(e){
				this.showWant = true;
				this.searchText = e;
			},
			getSearchText(e) {
				let _that = this;
				_that.showWant = false;
				_that.searchText = e;
				if(_that.$refs.contextSearchRef!=undefined){
					_that.$refs.contextSearchRef.openSearch(e);
				}
				
			}
		},
	}
</script> 